package com.example.demo.router.manager;

import com.example.demo.router.BaseRouter;
import com.example.demo.router.RouterCode;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/manager/account")
@Validated
public class AccountRouter extends BaseRouter {
    public AccountRouter() {
        this.pagePath = RouterCode.MANAGER_ACCOUNT.getPath();
        this.pluginPath = RouterCode.MANAGER_COMMON.getPath();
        this.template = RouterCode.MANAGER_TEMPLATE.getPath();
        this.title = RouterCode.MANAGER_TITLE.getPath();
    }

    /* 显示完整的网页 */
    @GetMapping("login")
    public String login(Model model) {
        initPage("login", "encrypt", "10.001", "店铺通登录页", model);
        return fullPage();
    }

    /* 显示模板组装的网页 */
    @GetMapping("user")
    public String user(Model model) {
        initPage("user", "edit,vue", "10.002", null, model);
        return template();
    }

    /* 显示完整的插件页 */
    @GetMapping("role")
    public String role(Model model) {
        initPlugin("role", "", "10.001", "完整的插件页", model);
        return fullPage();
    }

    /* 显示模板组装的插件页 */
    @GetMapping("menu")
    public String menu(Model model) {
        initPlugin("menu", "edit,vue", "10.001", "模板组装的插件页", model);
        return template();
    }

    /* 显示SSE测试页 */
    @GetMapping("sse")
    public String sse(Model model) {
        initPage("sse", "", "10.001", "SSE测试页", model);
        return template();
    }

    /* 显示下载测试页 */
    @GetMapping("download")
    public String download(Model model) {
        initPage("download", "", "10.001", "下载测试页", model);
        return template();
    }




    /* 有url拼接参数 */
    /*@GetMapping("user")
    public String user(@NoEmpty(message = "ID不能为空") @RequestParam String id,
                       Model model) {
        init("user", "edit,vue", "10.001", null, model);
        model.addAttribute("menuid", id);
        return template();
    }*/
}
